The present invention relates to the use of program space of a general purpose processor for translated instructions generally and, more particularly, to an apparatus and/or method for using a limited program space of a general purpose processor for an unlimited sequence of translated instructions.
JAVA is a programming language invented by Sun Microsystems, Inc. Applications developed using the JAVA language can be run on any platform equipped with a JAVA Virtual Machine (JVM). Applications written with JAVA can not match the performance of applications written in C/C++ and compiled directly into a native code. Several techniques to reduce the performance gap have been developed. However, while the techniques are successful in terms of narrowing the performance gap, the success is at the cost of extra memory foot-print or a lack of compatibility to past designs.
There are several major factors contributing to the lack of performance. Two of the larger factors are the need to perform garbage collection and the stack machine nature of the JVM. Garbage collection can constitute about 20-30% of the overall processing, while JAVA instruction execution uses the rest, including thread synchronization. Garbage collection consumes a substantial part of the total computing resources of the JVM. Performance could be improved by reducing the MIPS count for the garbage collection.
However, the largest factor contributing to the slow performance is the execution of the JAVA instructions. The execution of JAVA instructions uses a stack based architecture. The stack based architecture is well known for having a compact code size. However, the stack based architecture is also notoriously known for poor performance. Such an architecture reduces the options for compiler optimizations, and for runtime optimizations (such as using several functional units, as is done with super-scalar machines).
Three conventional techniques have been devised for speeding up the execution of Java instructions. However, each of the alternatives has a major penalty in some other aspect. The first technique uses Just In Time (JIT) technology to first translate the JAVA instructions while being downloaded into a processor native machine code. The processor native code version of the JAVA instructions contains all possible optimizations done by the JIT compiler during load time. The result is a fast executing native code that can require 4 or more times as much code memory (program space). The larger memory requirement almost instantly prohibits the use of JIT for embedded devices, where the memory is an expensive resource.
The second technique (i.e., HotSpot) generates optimized native code only for the parts of the JAVA instructions that are executed most of the time. Generating native code for only the most executed JAVA instructions requires on-the-fly profiling, and from time to time compilation tasks, that slow down the execution. The result can be a faster execution of the JAVA instructions on average. However, although the memory requirements are more reasonable, the speedup is not as good as can be provided by the JIT technique. Generating native code for only the most executed JAVA instructions might be more suitable for embedded systems, but the memory penalty can still be large without a drastic performance boost.
The third technique involves a full hardware implementation of the JVM (i.e., HW-JVM or a picojava core). The full hardware implementation of the JVM can provide a very fast executing machine. However, in order to use the full hardware implementation of the JVM, legacy code must be completely rewritten in Java. Therefore, the third technique is not backward compatible with older machines.
It would be desirable to have an apparatus and/or method for providing fast JAVA bytecode execution with a very low memory footprint and without requiring rewriting of code.
The present invention concerns an apparatus comprising a circuit configured to (i) translate one or more instruction codes of a first instruction set into a sequence of instruction codes of a second instruction set and (ii) present the sequence of instruction codes of the second instruction set in response to a predetermined number of addresses.
The objects, features and advantages of the present invention include providing an apparatus and/or method for generating an unlimited sequence of translated instructions in a limited program space of a general purpose processor that may (i) provide for fast execution of JAVA instructions, (ii) be used in embedded systems, (iii) be used in any on-the-fly translation engine for converting one instruction set to another, and/or (iv) maintain backward compatibility for legacy code.